package com.netease.course;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class LoggingAspect {

	// 运行之前打印日志
	@Before("execution(* com.netease.course.Caculator.*(..))")
	private void doLog(JoinPoint joinPoint){
		System.out.println("Before Method Run:" + joinPoint.toString());
	}

	@Before("execution(* com.netease.course.Caculator.*(..)) && args(a, ..)")
	private void arithmeticDoLog(JoinPoint jp, int a) {
		System.out.println(a + ": " + jp.toString());
	}

	@Pointcut("execution(* com.netease.course.Caaculator.*(..))")
	private void arithmetic(){
		System.out.println("Pointcut");
	}
}
